<?php
namespace Utuo\TagLib;

use Think\Template\TagLib;

class Dial extends TagLib {
	
	/**
	 * 定义标签列表
	 * @var array
	 */
	protected $tags = array(
		'get' => array('attr' => 'id', 'close' => 1), //获取指定分类列表
		'info' => array('attr' => 'id', 'close' => 1), //获取指定分类列表
	);
	
	/**
	 * 一键拨号
	 * @param array $tags
	 * @param string $content
	 */
	public function _get($tag, $content) {
		$id   = $tag['id'];
		$tt = <<<'EOT'
		<?php
			$__CONTENT__ = array();
			$__CONTENT__[] = M('ModuleDial')->find($sid);
		?>
		<volist name="__CONTENT__" id="%s">
		%s
		</volist>				
EOT;
		$parse = sprintf($tt, $id, $content);
		return $parse;
	}
	
	public function _info($tag, $content){
		$id = $tag['id'];
		$php = <<<'PHP'
			<?php
				$__CONTENT__ = array();
				$__CONTENT__[] = M('ModuleDial')->find($sid);
			?>
PHP;
		$tag = "<volist name='__CONTENT__' id='$id'>$content</volist>";
	}
}